import Mock from "mockjs";
// 获取 mock.Random 对象
const Random = Mock.Random;
Random.extend({
  field() {
    var list = [
      "新媒体",
      "特摄影视",
      "纳米技术",
      "光伏发电",
      "单机游戏",
      "5G",
      "音乐",
      "虚拟现实",
      "脑机接口",
      "区块链",
      "大数据",
      "人工智能",
      "云计算",
    ];
    return this.pick(list);
  },
});
// mock用户对象
export const mockfields = function () {
  let list = [];
  var field = [
    "新媒体",
    "特摄影视",
    "纳米技术",
    "光伏发电",
    "单机游戏",
    "5G",
    "音乐",
    "虚拟现实",
    "脑机接口",
    "区块链",
    "大数据",
    "人工智能",
    "云计算",
  ];
  for (let i = 0; i < Random.integer(13,13); i++) {
    // 模拟一个object对象，键为pk和fields，其中field指向另一个对象，里面是实体类
    var fundFields = Mock.mock({
      model: "BusinessSubSystem.fundField",
      "pk|1-100": 1,
      fields: {
        //生成随机的领域名称
        'fund_field_name|+1': field,
      },
    });
    list.push(fundFields);
  }

  return {
    data: JSON.stringify(list),
    flag: true,
  };
};
